package com.yunc.user.mq.disruptor;

import com.yunc.common.disruptor.AbstractEventHandler;
import com.yunc.common.disruptor.Event;
import com.yunc.common.disruptor.Handler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 处理代理商问题
 *
 * @author taocongcong
 * @create 2021-01-13 10:09
 */
@Slf4j
@Handler
@Component
public class SysUserUpdateEventHandler extends AbstractEventHandler<SysUserUpdateEvent> {

    @Override
    public boolean filter(Event event) {
        if (event.getValue().getClass() == SysUserUpdateEvent.class) {
            return true;
        }
        return false;
    }

    @Override
    public void handler(SysUserUpdateEvent obj) {
        try {
            // 处理
            log.info(obj.toString());
        } catch (Exception e) {
            log.error("用户更新队列disruptor发生错误，{}", e.toString());
        }
    }
}
